package com.geek.javase.ch10.work.listwork.work1;

/*
练习1：用LinkedList集合，模拟队列操作(存入的元素是Person对象)  先进先出
 */
public class Test {
    public static void main(String[] args) {
    Queue queue = new Queue();

    Person person1 = new Person(1, "张三", 12);
    Person person2 = new Person(2, "李四", 34);
    Person person3 = new Person(3, "王二", 23);

    // 将Person对象添加到队列中
    queue.put(person1);
    queue.put(person2);
    queue.put(person3);

    //队列中的元素
    System.out.println("队列中的元素: " + queue);

    System.out.println("队列头:" + queue.peek());


    while (!queue.isEmpty()) {
        Person person = queue.get();
        System.out.println("从队列中获取并移除元素: " + person);
    }

}

}
